package com.warmlight.voicepacket.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.warmlight.voicepacket.fragment.MyIMMessageFragment;
import com.warmlight.voicepacket.fragment.MyMessageFragment;

public class MyMessageVAdapter extends FragmentStatePagerAdapter {

    private String[] titles;
    private Context mContext;

    public MyMessageVAdapter(FragmentManager fm, Context ctx) {
        super(fm);
        this.mContext = ctx;
        titles =  new String[]{"消息","聊天"};
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            return MyMessageFragment.newInstance(0);
        } else {//卖家提醒
            return MyIMMessageFragment.newInstance(1);
        }
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

    @Override
    public int getCount() {
        return titles.length;
    }
//    public static View getTabView(int position) {
//        View tabView = LayoutInflater.from(mContext).inflate(R.layout.item_tab_layout, null);
//        TextView tabTitle = (TextView) tabView.findViewById(R.id.tv_tab_title);
//        tabTitle.setText(titles[position]);
//        return tabView;
//    }
}
